<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 根据输入的三个数字，判断是这一年的第几天
例如：

var year = 2016
var month = 2
var day = 11

// 逻辑代码

// 输出是第 42 天 -->
    <script>
        var year=parseInt(prompt("请输入年份"));
        var month=parseInt(prompt("请输入月份"));
        var day=parseInt(prompt("请输入日期"));
        var leapYear=(year%4==0 && year%100>0)||year%400==0
        var commonYear=!leapYear
        if(month==1){
            console.log(day);
        }else if(month==2){
            console.log(31+day);
        }else if(leapYear && month==3){
            console.log(31+29+day)
        }else if(leapYear && month==4){
            console.log(31+29+31+day)
        }else if(leapYear && month==5){
            console.log(31+29+31+30+day)
        }else if(leapYear && month==6){
            console.log(31+29+31+30+31+day)
        }else if(leapYear && month==7){
            console.log(31+29+31+30+31+30+day)
        }else if(leapYear && month==8){
            console.log(31+29+31+30+31+30+31+day)
        }else if(leapYear && month==9){
            console.log(31+29+31+30+31+30+31+31+day)
        }else if(leapYear && month==10){
            console.log(31+29+31+30+31+30+31+31+30+day)
        }else if(leapYear && month==11){
            console.log(31+29+31+30+31+30+31+31+30+31+day)
        }else if(leapYear && month==12){
            console.log(31+29+31+30+31+30+31+31+30+31+30+day)
        }else if(commonYear && month==3){
            console.log(31+28+day)
        }else if(commonYear && month==4){
            console.log(31+28+31+day)
        }else if(commonYear && month==5){
            console.log(31+28+31+30+day)
        }else if(commonYear && month==6){
            console.log(31+28+31+30+31+day)
        }else if(commonYear && month==7){
            console.log(31+28+31+30+31+30+day)
        }else if(commonYear && month==8){
            console.log(31+28+31+30+31+30+31+day)
        }else if(commonYear && month==9){
            console.log(31+28+31+30+31+30+31+31+day)
        }else if(commonYear && month==10){
            console.log(31+28+31+30+31+30+31+31+30+day)
        }else if(commonYear && month==11){
            console.log(31+28+31+30+31+30+31+31+30+31+day)
        }else if(commonYear && month==12){
            console.log(31+28+31+30+31+30+31+31+30+31+30+day)
        }


        
        

    </script>
</body>

</html>